const path = require("path");
const webpack = require("webpack");

var APP_PATH = path.resolve(__dirname, './src/main.js');
var BUILD_PATH = path.resolve(__dirname, './dist');

module.exports = {
    entry: [
      APP_PATH
    ],
    output: {
        path: BUILD_PATH,
        filename: "bundle.js",
        publicPath: '/dist/'
    },
    resolve: {
        extensions: [".js"],
        // required for enzyme to work properly
        alias: {
          'sinon': 'sinon/pkg/sinon'
        },
        modules: [
            __dirname,
            path.resolve(__dirname, "./node_modules")
        ]
    },
    devtool:'inline-source-map',
    module: {
        // don't run babel-loader through the sinon module
        noParse: [
          /node_modules\/sinon\//
        ],
        loaders: [
            {
        		test: /\.js$/,
        		loader: "babel-loader",
        		exclude:/\/node_modules\//,
                query: {
                    presets: ['airbnb']
                }
            }
        ]

    },
    // required for enzyme to work properly
    externals: {
        'jsdom': 'window',
        'cheerio': 'window',
        'react/lib/ExecutionEnvironment': true,
        'react/lib/ReactContext': true,
    }
};
